﻿using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Codemonk.Common.ObjectModel;

namespace Codemonk.CloudBox.UnitTests.Transactions
{
    [TestClass]
    public class UnitTest1
    {
        TransactionObject<int> a = 90;
        TransactionObject<int> b = 90;
        TransactionObject<int> c = 90;
        Random r = new Random();
        [TestMethod]
        public void TestMethod1()
        {
            System.Threading.Tasks.Parallel.For(1, 200, i =>
            {
                using (var context = new TransactionContext())
                {
                    a += 56; b += 78; c += 53;
                    System.Threading.Thread.Sleep(r.Next(1, 1000));
                    Console.WriteLine(context.Count);
                }
            });
        }
    }
}
